package cn.ava.ymcc.feign.fallback;

import cn.ava.ymcc.feign.CourseFeignClient;
import cn.ava.ymcc.feign.CourseUserLearnFeignClient;
import cn.ava.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseClientFallbackFactory implements FallbackFactory<CourseFeignClient> {

    @Override
    public CourseFeignClient create(Throwable cause) {
        return new CourseFeignClient() {
            @Override
            public JSONResult info(String courseIds) {
                return JSONResult.error("课程服务不可用!");
            }
            @Override
            public JSONResult get(Long id) {
                return JSONResult.error("课程服务不可用!");
            }
        };
    }
}
